<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>ArrayAugmentsTest</title>

<link rel="stylesheet"
	href="http://code.jquery.com/qunit/qunit-1.15.0.css">
<script src="http://code.jquery.com/qunit/qunit-1.15.0.js"></script>

<script src="../../../main/js/util/Logger.js"></script>
<script src="../../../main/js/util/ArrayAugments.js"></script>

<script>
    var LOGGER = new Logger();

    QUnit.test("contains()", function(assert)
    {
        // Setup.
        var array = [ "a", "b", [ "c", "d" ] ];

        // Run / Verify.
        assert.ok(array.contains("a"));
        assert.ok(array.contains("b"));
        assert.ok(!array.contains("c"));
        assert.ok(!array.contains("d"));

        assert.ok(!array.contains([ "a", "b" ]));
        assert.ok(array.contains([ "c", "d" ]));
        assert.ok(!array.contains([ "e", "f" ]));
    });

    QUnit.test("equals()", function(assert)
    {
        // Setup.
        var a = [ 1, 2, 3 ];
        var b = [ 3, 2, 1 ];
        var c = new Array(1, 2, 3);

        // Run / Verify.
        assert.ok(a.equals(a));
        assert.ok(!a.equals(b));
        assert.ok(a.equals(c));

        assert.ok(!b.equals(a));
        assert.ok(b.equals(b));
        assert.ok(!b.equals(c));

        assert.ok(c.equals(a));
        assert.ok(!c.equals(b));
        assert.ok(c.equals(c));
    });

    QUnit.test("subarray equals()", function(assert)
    {
        // Setup.
        var a = [ 1, 2, [ 3, 4 ] ];
        var b = [ 3, 2, [ 1, 0 ] ];
        var c = new Array(1, 2, [ 3, 4 ]);

        // Run / Verify.
        assert.ok(a.equals(a));
        assert.ok(!a.equals(b));
        assert.ok(a.equals(c));

        assert.ok(!b.equals(a));
        assert.ok(b.equals(b));
        assert.ok(!b.equals(c));

        assert.ok(c.equals(a));
        assert.ok(!c.equals(b));
        assert.ok(c.equals(c));
    });
</script>
</head>
<body>
	<div id="qunit"></div>
</body>
</html>
